-module(pt_game_continue_action_b005).
-include("pt.hrl").

-export([new/0,from_binary/1,to_binary/1,to_binary/2,get_id/0]).

get_id()-> 16#B005.

new()->#pt_game_continue_action{}.

from_binary(Binary) -> 
	{Binary1,Data1} = lib_protocol:from_binary(Binary,uint8),
	{Binary2,Data2} = lib_protocol:from_binary(Binary1,uint16),
	{Binary3,Data3} = lib_protocol:from_binary(Binary2,uint8),
	{Binary4,Data4} = lib_protocol:from_binary(Binary3,uint32),
	{Binary5,Data5} = lib_protocol:from_binary(Binary4,uint32),
	{Binary6,Data6} = lib_protocol:from_binary(Binary5,uint8),
	{Binary7,Data7} = lib_protocol:from_binary(Binary6,uint16),
	{Binary8,Data8} = lib_protocol:from_binary(Binary7,uint16),
	{Binary9,Data9} = lib_protocol:from_binary(Binary8,uint16),
	{Binary10,Data10} = lib_protocol:from_binary(Binary9,uint16),
	{Binary11,Data11} = lib_protocol:from_binary(Binary10,uint32),
	{Binary12,Data12} = lib_protocol:from_binary(Binary11,uint16),
	{_Binary,Data13} = lib_protocol:from_binary(Binary12,{list,action_data_from_binary}),
	#pt_game_continue_action{
		last_index = Data1,
		last_qp = Data2,
		cur_index = Data3,
		cur_time = Data4,
		field = Data5,
		action = Data6,
		action_data1 = Data7,
		action_data2 = Data8,
		action_data3 = Data9,
		action_data4 = Data10,
		del_field = Data11,
		qp_num = Data12,
		my_actions = Data13
	}.

to_binary(Pt) -> to_binary(Pt,0).
to_binary(Pt,Seq) -> 
	Data1 = lib_protocol:to_binary(Pt#pt_game_continue_action.last_index,uint8),
	Data2 = lib_protocol:to_binary(Pt#pt_game_continue_action.last_qp,uint16),
	Data3 = lib_protocol:to_binary(Pt#pt_game_continue_action.cur_index,uint8),
	Data4 = lib_protocol:to_binary(Pt#pt_game_continue_action.cur_time,uint32),
	Data5 = lib_protocol:to_binary(Pt#pt_game_continue_action.field,uint32),
	Data6 = lib_protocol:to_binary(Pt#pt_game_continue_action.action,uint8),
	Data7 = lib_protocol:to_binary(Pt#pt_game_continue_action.action_data1,uint16),
	Data8 = lib_protocol:to_binary(Pt#pt_game_continue_action.action_data2,uint16),
	Data9 = lib_protocol:to_binary(Pt#pt_game_continue_action.action_data3,uint16),
	Data10 = lib_protocol:to_binary(Pt#pt_game_continue_action.action_data4,uint16),
	Data11 = lib_protocol:to_binary(Pt#pt_game_continue_action.del_field,uint32),
	Data12 = lib_protocol:to_binary(Pt#pt_game_continue_action.qp_num,uint16),
	Data13 = lib_protocol:to_binary(Pt#pt_game_continue_action.my_actions,{list,action_data_to_binary}),
	GetData = <<Data1/binary,Data2/binary,Data3/binary,Data4/binary,Data5/binary,Data6/binary,Data7/binary,Data8/binary,Data9/binary,Data10/binary,Data11/binary,Data12/binary,Data13/binary>>,
	lib_protocol:make_pt(GetData,get_id(),Seq).

